import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/generated/a.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:finance_app/src/common/app_spaces.dart';
import 'package:finance_app/src/utils/date_time_utils.dart';
import 'package:finance_app/src/widgets/common/tag_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';

class SubCompanyItem extends StatelessWidget {
  final String companyName;
  final String planName;
  final bool isExpired;
  final VoidCallback onTap;

  SubCompanyItem(
      {Key key, this.companyName, this.planName, this.isExpired, this.onTap})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return PressedOpacityButton(
      padding: EdgeInsets.symmetric(horizontal: getDp(26), vertical: getDp(12)),
      color: Colors.white,
      borderRadius: BorderRadius.circular(getDp(10)),
      boxShadow: [
        BoxShadow(
          offset: Offset(0.0, getDp(4)),
          blurRadius: getDp(22),
          spreadRadius: -getDp(4),
          color: Colors.black.withOpacity(0.25),
        ),
      ],
      onPressed: onTap,
      child: Row(
        children: [
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  '$companyName',
                  style: TextStyle(
                    color: aceBlackColor,
                    fontSize: getSp(20),
                    fontWeight: FontWeight.w700,
                    height: 22 / 16,
                  ),
                ),
                Row(
                  children: [
                    Text(
                      '$planName',
                      style: TextStyle(
                        color: aceBlackColor,
                        fontSize: getSp(16),
                        height: 22 / 16,
                      ),
                    ),
                    AppSpaces.w15,
                    if (isExpired != null)
                      if (isExpired)
                        RedTagWidget(
                          content: 'Expired',
                        )
                      else
                        GreenTagWidget(
                          content: 'Ongoing',
                        ),
                  ],
                ),
              ],
            ),
          ),
          RotatedBox(
            quarterTurns: 3,
            child: SvgPicture.asset(
              A.assetsImagesStyleArrowBlack,
              color: aceBlackColor,
              width: getDp(8),
              height: getDp(8),
            ),
          ),
        ],
      ),
    );
  }
}
